<template>
  <div class="btn-list">
    <el-button type="primary" @click="upload">新增</el-button>
    <el-button @click="upload">删除</el-button>
  </div>

  <el-table
    :data="tableData"
    stripe
    style="width: 100%"
    border
    header-cell-class-name="table_header"
    :header-cell-style="{ background: '#f8f8f9' }"
    @selection-change="handleSelectionChange"
  >
    <el-table-column type="selection" width="55" align="center" />
    <el-table-column label="序号" type="index" width="100" align="center" />
    <el-table-column prop="date" label="分组名" width="180" align="center" />
    <el-table-column prop="name" label="分组编码" align="center" />
    <el-table-column prop="address" label="分组类型" align="center" />
    <el-table-column prop="address" label="l18nKey" align="center" />
    <el-table-column label="扩展" width="180" align="center">
      <template #default="scope">
        <!-- <el-button type="primary" link>查看</el-button>
        <el-button type="warning" link>修改</el-button>
        <el-button type="danger" link>删除</el-button> -->
      </template>
    </el-table-column>
  </el-table>

  <el-dialog v-model="dialogVisible" title="上传附件" width="38%">
    <el-upload
      class="upload-demo"
      drag
      action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
      multiple
    >
      <el-icon class="el-icon--upload"><upload-filled /></el-icon>
      <div class="el-upload__text">将文件拖到此处, <em>或点击上传</em></div>
      <template #tip>
        <div class="el-upload__tip">
          注:允许上传的附件 rar/zip 大小最大为100M
        </div>
      </template>
    </el-upload>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="dialogVisible = false">取消</el-button>
        <el-button type="primary" @click="dialogVisible = false">
          上传
        </el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { ref, reactive } from "vue";
import { UploadFilled } from "@element-plus/icons-vue";
const tableData = [
  {
    date: "2016-05-03",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-02",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-04",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-01",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-03",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-02",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-04",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
  {
    date: "2016-05-01",
    name: "Tom",
    address: "No. 189, Grove St, Los Angeles",
  },
];
// 弹框
const dialogVisible = ref(false);
// 上传按钮
const upload = () => {
  dialogVisible.value = true;
};
let multipleSelection = ref([]);
// 多选项
const handleSelectionChange = (val: any) => {
  multipleSelection.value = val;
};
</script>

<style lang="scss" scoped>
.btn-list {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0;
}
</style>
